package com.liujit.bms.app.api;

import com.liujit.bms.app.fallback.BmsAppFeignFallbackClient;
import com.liujit.bms.app.domain.model.BlogMember;
import com.liujit.bms.app.domain.params.BlogMemberParams;
import com.liujit.common.domain.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author: liujun
 * @date: 2021/6/21 10:14 下午
 * @description: 博客服务远程调用
 */
@FeignClient(value = "bms-app", fallback = BmsAppFeignFallbackClient.class)
public interface BmsAppFeignClient {

    /**
     * 根据微信openid获取博客会员
     *
     * @param openId 微信openid
     * @return
     * @author: liujun
     * @date: 2021/6/21 10:25 下午
     */
    @GetMapping("/blog/member/getByOpenId")
    Result<BlogMember> getByOpenId(@RequestParam("openId") String openId);

    /**
     * 根据博客会员添加请求参数，添加博客会员
     *
     * @param params 博客会员添加请求参数
     * @return 添加结果
     * @author: liujun
     * @date: 2021/6/21 10:25 下午
     */
    @PostMapping("/blog/member/add")
    Result<BlogMember> addMember(@RequestBody BlogMemberParams params);
}
